<?php
/**
* The default bootstrap script. Used when no site-specific bootstrap is found.
*
* @package Scribble
* @subpackage SkeletonApp
*/
use Buan\Config;
use Buan\Database;
use Buan\ExtensionManager;

// Set timezone and start a session
date_default_timezone_set('Europe/London');
session_start();

// Define database connections
Database::addConnection(array(
	'name'=>'default',
	'driver'=>'mysql',
	'dsn'=>'mysql:host=localhost;dbname=scribble_db',
	'username'=>'scribble_user',
	'password'=>'scribble_pass'
));

// Configure the Scribble extension
$scribble = ExtensionManager::get('Scribble');
$scribble->configure(dirname(dirname(__FILE__)).'/scribble-data', '.html');
$scribble->addMenuSlots('main,footer');
$scribble->setUploadPath(Config::get('app.docRoot').'/cms-documents', '/cms-documents');
ScribbleTemplateManager::addTemplatePath(Config::get('app.docRoot').'/cms-templates', '/cms-templates');
ScribbleTemplateManager::setDefaultOuterTemplate('sample-outer');

// Register and configure any required Scribble plugins
ScribblePluginManager::register(Config::get('ext.Scribble.docRoot').'/plugins/sp-spider/SpSpider.php');
$spider = ScribblePluginManager::get('SpSpider');
$spider->configure();

// Finally, apply environment-specific configuration
$scribble->configureEnvironment(ScribbleEnvironment::get());
?>